package com.example.demo.mapper;

import com.example.demo.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {

    /**
     * 根据用户名查询员工
     * @param username
     * @return
     */
    @Select("select * from Users where user_name = #{username}")
    User getByUsername(String username);

    /**
     * 插入员工数据
     * @param user
     */
    @Insert("insert into Users (user_name, password, credit, today_get) " +
            "values" +
            "(#{username}, #{password}, #{credit}, #{today_get})")
    void insert(User user);
}
